package com.atwulidun.recursion;

public class Print {
    public static void main(String[] args) {
//        sequentialPrint(5);
        reversePrint(5);
    }

    // 顺序打印
    public static void sequentialPrint(int n) {
        System.out.println("n = " + n);
        if (n > 1) {
            sequentialPrint(n - 1);
        }
    }

    // 逆序打印
    public static void reversePrint(int n) {
        if (n > 1) {
            reversePrint(n - 1);
        }
        System.out.println("n = " + n);
    }
}
